| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Mesh.h
1 // Mesh.h
3 //
5
6 namespace nkGraphics
7 {
13 class Mesh : public Resource, public nkExport::Exportable
14 {
15 public :
16
20 virtual ~Mesh () ;
21
22 // Getters
26 const BoundingBox& getBounds () const ;
36 nkMemory::BufferView<unsigned char> getVertexBuffer (unsigned int index) const ;
43 unsigned int getVertexBufferStride (unsigned int index) const ;
47 unsigned int getVertexBufferCount () const ;
56 nkMemory::BufferView<unsigned char> getIndexBuffer () const ;
62 const MeshInputLayout& getInputLayout () const ;
66 unsigned int getId () const ;
70 unsigned int getVertexCount () const ;
74 unsigned int getIndexCount () const ;
78 PRIMITIVE_TOPOLOGY getTopology () const ;
82 INDEX_FORMAT getIndexFormat () const ;
86 bool getAutoComputeBounds () const ;
97 virtual Buffer* getVertexGpuBuffer (unsigned int index) const ;
105 virtual Buffer* getIndexGpuBuffer () const ;
106
107 // Setters
113 void setBounds (const BoundingBox& value) ;
124 void addVertexBuffer (nkMemory::BufferView<unsigned char> view, unsigned int stride = 0) ;
135 void addVertexBufferCopy (nkMemory::BufferView<unsigned char> view, unsigned int stride = 0) ;
146 void addVertexBufferForward (nkMemory::Buffer&& buffer, unsigned int stride = 0) ;
152 void removeVertexBuffer(unsigned int index) ;
162 void setIndexBuffer (nkMemory::BufferView<unsigned char> view) ;
172 void setIndexBufferCopy (nkMemory::BufferView<unsigned char> view) ;
182 void setIndexBufferForward (nkMemory::Buffer&& buffer) ;
188 void setInputLayout (const MeshInputLayout& layout) ;
194 void setId (unsigned int value) ;
200 void setVertexCount (int value) ;
206 void setIndexCount (int value) ;
212 void setTopology (PRIMITIVE_TOPOLOGY value) ;
218 void setIndexFormat (INDEX_FORMAT value) ;
224 void setAutoComputeBounds (bool value) ;
225
226 // Init
232 void computeBounds (nkMemory::StringView positionAttributeName) ;
233
234 // Loading
235 virtual bool load () override ;
236
237 // Memory freeing
242 virtual void freeShadowBuffers () ;
243
244 // Import / Export
245 virtual void exportClassToTree (nkExport::Node* rootNode) override ;
246 virtual void importClassFromTree (nkExport::Node* rootNode) override ;
247
248 public :
249
250 // Statics
258 static nkMemory::UniquePtr<Mesh> create (System* system = nullptr) ;
259 } ;
260 }
nkGraphics::Mesh::addVertexBufferCopy
void addVertexBufferCopy(nkMemory::BufferView< unsigned char > view, unsigned int stride=0)
nkGraphics::Mesh::exportClassToTree
virtual void exportClassToTree(nkExport::Node *rootNode) override
nkGraphics::Mesh::~Mesh
virtual ~Mesh()
nkGraphics::Mesh::setInputLayout
void setInputLayout(const MeshInputLayout &layout)
nkGraphics::Mesh::setBounds
void setBounds(const BoundingBox &value)
nkGraphics::Mesh::getBounds
const BoundingBox & getBounds() const
nkGraphics::Mesh::addVertexBuffer
void addVertexBuffer(nkMemory::BufferView< unsigned char > view, unsigned int stride=0)
nkGraphics::Mesh::getVertexGpuBuffer
virtual Buffer * getVertexGpuBuffer(unsigned int index) const
nkGraphics::System
Main interface with the component system.
Definition: System.h:14
nkGraphics::INDEX_FORMAT
INDEX_FORMAT
Enumerates all formats supported for indices in a mesh.
Definition: IndexFormat.h:12
nkGraphics::Mesh::getVertexBufferStride
unsigned int getVertexBufferStride(unsigned int index) const
nkExport::Exportable
An interface to define objects that can be exported using this component.
Definition: Exportable.h:15
nkGraphics::Mesh::setId
void setId(unsigned int value)
nkGraphics::Mesh::setIndexBufferCopy
void setIndexBufferCopy(nkMemory::BufferView< unsigned char > view)
nkMemory::BufferView< unsigned char >
nkGraphics::Mesh::load
virtual bool load() override
nkGraphics::BoundingBox
A bounding box. Often used to encompass object's bounds in the world.
Definition: BoundingBox.h:14
nkGraphics::Buffer
A buffer that will reside on the GPU.
Definition: Buffer.h:17
nkGraphics::Mesh::setAutoComputeBounds
void setAutoComputeBounds(bool value)
nkGraphics::MeshInputLayout
Describes the layout of data inside a mesh.
Definition: MeshInputLayout.h:12
nkGraphics::Mesh::importClassFromTree
virtual void importClassFromTree(nkExport::Node *rootNode) override
nkGraphics::Mesh::setIndexBufferForward
void setIndexBufferForward(nkMemory::Buffer &&buffer)
nkGraphics::Mesh::setIndexFormat
void setIndexFormat(INDEX_FORMAT value)
nkGraphics::Mesh::getIndexBuffer
nkMemory::BufferView< unsigned char > getIndexBuffer() const
nkGraphics::Mesh::getVertexBuffer
nkMemory::BufferView< unsigned char > getVertexBuffer(unsigned int index) const
nkGraphics::Mesh::getInputLayout
const MeshInputLayout & getInputLayout() const
nkGraphics::Mesh::getIndexCount
unsigned int getIndexCount() const
nkGraphics::Mesh::setIndexBuffer
void setIndexBuffer(nkMemory::BufferView< unsigned char > view)
nkGraphics::PRIMITIVE_TOPOLOGY
PRIMITIVE_TOPOLOGY
Enumerates all primitive topologies supported for meshes.
Definition: PrimitiveTopology.h:14
nkGraphics::Mesh::getId
unsigned int getId() const
nkMemory::Buffer
A buffer holding binary data.
Definition: Buffer.h:32
nkGraphics::Mesh::setTopology
void setTopology(PRIMITIVE_TOPOLOGY value)
nkGraphics::Mesh::removeVertexBuffer
void removeVertexBuffer(unsigned int index)
nkGraphics::Mesh::getVertexCount
unsigned int getVertexCount() const
nkExport::Node
A node in the tree structure representing the data to export / import.
Definition: Node.h:42
nkGraphics::Mesh::getVertexBufferCount
unsigned int getVertexBufferCount() const
nkGraphics::Mesh::getIndexGpuBuffer
virtual Buffer * getIndexGpuBuffer() const
nkGraphics::Mesh::getTopology
PRIMITIVE_TOPOLOGY getTopology() const
nkMemory::UniquePtr
Smart pointer owning the object instance it encapsulates.
Definition: UniquePtr.h:17
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkGraphics::Mesh::create
static nkMemory::UniquePtr< Mesh > create(System *system=nullptr)
nkGraphics::Mesh::setVertexCount
void setVertexCount(int value)
nkGraphics::Resource
Base class for a resource in the component.
Definition: Resource.h:12
nkGraphics::Mesh::setIndexCount
void setIndexCount(int value)
nkGraphics::Mesh::computeBounds
void computeBounds(nkMemory::StringView positionAttributeName)
nkGraphics::Mesh::getAutoComputeBounds
bool getAutoComputeBounds() const
nkGraphics::Mesh::addVertexBufferForward
void addVertexBufferForward(nkMemory::Buffer &&buffer, unsigned int stride=0)
nkGraphics::Mesh::getIndexFormat
INDEX_FORMAT getIndexFormat() const
nkGraphics
Encompasses all API of component NilkinsGraphics.
Definition: BoundingBox.h:7
nkGraphics::Mesh
Holds information about a mesh. Used as a basis to render 3d models.
Definition: Mesh.h:14
nkGraphics::Mesh::freeShadowBuffers
virtual void freeShadowBuffers()